package nmrworkflow.framework.functionwrappers.nmrpipe;

import nmrworkflow.framework.functionwrappers.Argument;
import nmrworkflow.framework.functionwrappers.Function;

/**
 * Wraps NMRPipe's Correct Baseline Function
 * @author rjn
 *
 */
public class NmrPipeCbf extends BaseNmrPipeWrapper {

	private int startPercent;
	private int endPercent;
	
	/**
	 * Defaults to the last 12%
	 *
	 */
	public NmrPipeCbf() {
		super();
		
		startPercent = 89;
		endPercent = 100;
	}
	
	/**
	 * Arguments are between 0 and 100.
	 * @param startPercent
	 * @param endPercent
	 */
	public NmrPipeCbf(int startPercent, int endPercent) {
		super();
		
		this.setStartPercent(startPercent);
		this.setEndPercent(endPercent);
	}

	@Override
	protected Function buildFunction() {
		Function cbf = new Function("CBF");
		cbf.addArgument(new Argument("reg", new String[] {startPercent + "%", endPercent + "%"}));
		
		return cbf;
	}

	public int getEndPercent() {
		return endPercent;
	}
	
	/**
	 * Argument must be between 0 and 100
	 * @param endPercent
	 */
	public void setEndPercent(int endPercent) {
		if(0 <= endPercent && endPercent <= 100)
			this.endPercent = endPercent;
	}

	public int getStartPercent() {
		return startPercent;
	}
	
	/**
	 * Argument must between 0 and 100
	 * @param startPercent
	 */
	public void setStartPercent(int startPercent) {
		if(0 <= startPercent && startPercent <= 100)
			this.startPercent = startPercent;
	}

}
